import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/main/app_bar.dart';
import 'package:flutter_eve_plugin/route/main.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/store_vm/ye_xiu/login/main.dart';
import 'package:flutter_eve_plugin/store_vm/ye_xiu/main.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class LoginBindingSUCCPage extends StatefulWidget {
  final String title;

  LoginBindingSUCCPage({Key key, this.title}) : super(key: key);

  @override
  _LoginBindingSUCCPageState createState() => _LoginBindingSUCCPageState();
}

class _LoginBindingSUCCPageState extends State<LoginBindingSUCCPage> {
  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(converter: (store) {
      return AppStateViewModel(
          state: store.state,
          yeXiuStateViewModel: YeXiuStateViewModel(
              loginStateViewModel: LoginStateViewModel(bindSUCCNext: () {
            Navigator.pushNamed(context, RouteConstant.LoginSelectRolePage);
          })));
    }, builder: (context, vm) {
      return Scaffold(
        backgroundColor: Colors.white,
        appBar: buildAppBar(context,
            type: FigureIP.YE_XIU, colors: [Colors.white, Colors.white]),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              padding: EdgeInsets.only(left: setRatio(30), top: setRatio(20)),
              child: Text(
                '机器绑定成功！',
                style: TextStyle(
                    fontSize: setTextSp(24),
                    color: Color((0xFF333333)),
                    fontWeight: FontWeight.bold),
              ),
            ),
            SizedBox(
              height: setRatio(50),
            ),
            Image.asset(
              imageUtilYeXiu('login/icon_machine@2x'),
              width: setRatio(375),
              height: setRatio(353),
            ),
            Expanded(child: Container()),
            GestureDetector(
              onTap: vm.yeXiuStateViewModel.loginStateViewModel.bindSUCCNext,
              child: Container(
                margin: EdgeInsets.only(
                    left: setRatio(30),
                    right: setRatio(30),
                    bottom: setRatio(44)),
                height: setRatio(46),
                decoration: BoxDecoration(
                    borderRadius:
                        BorderRadius.all(Radius.circular(setRatio(5))),
                    gradient: LinearGradient(
                        colors: [Color(0xFF0386FF), Color(0xFF03AAFF)],
                        begin: Alignment(0.5, 0),
                        end: Alignment(0.5, 1))),
                child: Center(
                  child: Text(
                    '下一步，选择角色',
                    style: TextStyle(
                        fontSize: setTextSp(17), color: Color(0xFFFFFFFF)),
                  ),
                ),
              ),
            )
          ],
        ),
      );
    });
  }
}
